<!-- TABLE html5_blog__comments
    (
        comment_ID bigint NOT NULL AUTO_INCREMENT,
        comment_post_ID bigint DEFAULT '0' NOT NULL,
        comment_author tinytext NOT NULL,
        comment_author_email VARCHAR(100) NOT NULL,
        comment_author_url VARCHAR(200) NOT NULL,
        comment_author_IP VARCHAR(100) NOT NULL,
        comment_date DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
        comment_date_gmt DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
        comment_content text NOT NULL,
        comment_karma INT DEFAULT '0' NOT NULL,
        comment_approved VARCHAR(20) DEFAULT '1' NOT NULL,
        comment_agent VARCHAR(255) NOT NULL,
        comment_type VARCHAR(20) NOT NULL,
        comment_parent bigint DEFAULT '0' NOT NULL,
        user_id bigint DEFAULT '0' NOT NULL,
        PRIMARY KEY (comment_ID),
        INDEX comment_approved (comment_approved),
        INDEX comment_post_ID (comment_post_ID),
        INDEX comment_approved_date_gmt (comment_approved, comment_date_gmt),
        INDEX comment_date_gmt (comment_date_gmt),
        INDEX comment_parent (comment_parent)
    )-->


<?php
class Comment_model extends CI_Model {
	
	private $html5_blog__comments= 'html5_blog__comments';
	
	function __construct(){
		parent::__construct();
	}
	
	function list_all(){
		$this->db->order_by('id','asc');
		return $this->db->get($html5_blog__comments);
	}
	
	function count_all(){
		return $this->db->count_all($this->html5_blog__comments);
	}
	
	function get_paged_list($limit = 10, $offset = 0){
		$this->db->order_by('id','asc');
		return $this->db->get($this->html5_blog__comments, $limit, $offset);
	}
	
	function get_by_id($id){
		$this->db->where('id', $id);
		return $this->db->get($this->html5_blog__comments);
	}
	
	function save($person){
		$this->db->insert($this->html5_blog__comments, $person);
		return $this->db->insert_id();
	}
	
	function update($id, $person){
		$this->db->where('id', $id);
		$this->db->update($this->html5_blog__comments, $person);
	}
	
	function delete($id){
		$this->db->where('id', $id);
		$this->db->delete($this->html5_blog__comments);
	}
}
?>